class Solution {
public:
    int maxArea(vector<int>& height) {

        int nRet=0;
        int n=height.size();
        int left=0,right=n-1;
        while(left<right){
            nRet=max(min(height[left],height[right])*(right-left),nRet);
            if(height[left]<height[right]){
                ++left;
            }
            else{
                --right;
            }
        }

        return nRet;
    }
};
